package com.mxpio.erp.common.technology.vo;

import com.mxpio.erp.common.technology.entity.ItemGroup;
import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.security.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;


@Data
@EqualsAndHashCode(callSuper=false)
@Schema(description="产品Bom对应明细实时库存分析")
public class ProductBomStockAnalysisVO implements DictAble {

	private static final long serialVersionUID = 1L;


	@Schema(description = "行号")
	private String lineNo;

	@Schema(description = "物料代码")
	private String itemCode;

	@Schema(description = "物料组")
	@Dict(dicCode = "groupCode", dicEntity = ItemGroup.class, dicText = "groupName")
	private String itemGroupCode;

	@Schema(description = "物料名称")
	private String itemName ;

	@Schema(description = "规格型号")
	private String itemSpec;

	@Schema(description = "单位编号")
	@Dict(dicCode="ERP_TECH_UNIT_CODE")
	private String unitCode;

	@Schema(description = "图号")
	private String drawingNo;

	@Schema(description = "供料方式")
	@Dict(dicCode = "ERP_TECH_FEEDING_MODE")
	private String feedingMode;

	@Column(name = "MATERIAL_BRAND_")
	@Schema(description = "材料牌号")
	private String materialBrand;

	@Column(name = "MATERIAL_TYPE_")
	@Schema(description = "材料类型")
	@Dict(dicCode = "ERP_TECH_MATERIAL_TYPE")
	private String materialType;

	@Schema(description = "成套数量")
	private BigDecimal setQuantity = BigDecimal.ZERO;

	@Column(name = "KITTING_QUANTITY_")
	@Schema(description = "齐套分析配套数量")
	private BigDecimal kittingQuantity;

	@Column(name = "ANALYSIS_COLOR_")
	@Schema(description = "齐套分析结果颜色")
	private String analysisColor;

	@Schema(description = "子项物料基本用量")
	private BigDecimal itemConsumption;

	@Transient
	@Schema(description = "齐套分析实时对应物料实时库存数量")
	private BigDecimal stockLiveQuantity;


	@Transient
	private Map<String, String> textMap;

	public String putText(String key, String value) {
		if (textMap == null) {
			textMap = new HashMap<>();
		}
		return textMap.put(key, value);
	}
}
